OpenCities Map CONNECT Edition Help

Creating an Annotation Table

The following spatial table is used as the parent table for annotation:

CREATE TABLE PARCELS 
(Owner VARCHAR2(20),
Market_Value VARCHAR2(10),
Parcel_ID NUMBER PRIMARY KEY,
Geometry MDSYS.SDO_GEOMETRY);


CREATE SEQUENCE PARCELS_SEQ 
START WITH 2001 INCREMENT BY 1;


INSERT INTO USER_SDO_GEOM_METADATA (TABLE_NAME, COLUMN_NAME, DIMINFO, SRID)
VALUES ('PARCELS', 'Geometry',
MDSYS.SDO_DIM_ARRAY
(MDSYS.SDO_DIM_ELEMENT('X', 2197290.78478466, 2401264.08333616, 0.000000050), 
MDSYS.SDO_DIM_ELEMENT('Y', 703310.077261334, 911592.401111043, 0.000000050)),
NULL);


CREATE INDEX PARCELS_SIDX ON PARCELS(Geometry) 
INDEXTYPE IS MDSYS.SPATIAL_INDEX_V2 
PARAMETERS('layer_gtype=multipolygon');

The following the CREATE TABLE and CREATE SEQUENCE statements for a table that stores annotations for the parcels table:

CREATE TABLE OWNER_TEXT 
(Owner_Text_ID NUMBER NOT NULL,
Parcel_ID_REF NUMBER NOT NULL,
MS_Angle NUMBER,
MS_X_Scale NUMBER,
MS_Y_Scale NUMBER,
Owner_Text_Location MDYS.SDO_GEOMETRY);

CREATE SEQUENCE OWNER_TEXT_SEQ
START WITH 2001 INCREMENT BY 1;

As with the parent table (Parcels), a sequence is created to ensure that the table’s identifier (Owner_Text_ID) will be unique when annotations are added or removed in OpenCities Map.

Next to the table’s identifier, a column that references the identifier in the root table is specified (Parcel_ID_Ref). The angle column angle store the angle that the text is placed under and the SDO_GEOMETRY field stores the location of the text element. Note that the angle can be either radians or degrees. This is specified when registering the feature.

Like for any spatial table, an entry in the USER_SDO_GEOM_METADATA view and a spatial index are required for OpenCities Map to work with the table:

INSERT INTO USER_SDO_GEOM_METADATA (TABLE_NAME, COLUMN_NAME, DIMINFO, SRID)
VALUES ('OWNER_TEXT', ‘OWNER_TEXT_LOCATION’, MDSYS.SDO_DIM_ARRAY
(MDSYS.SDO_DIM_ELEMENT('X', 2197290.78478466, 2401264.08333616, 0.000000050), 
MDSYS.SDO_DIM_ELEMENT('Y', 703310.077261334, 911592.401111043, 0.000000050)
),
NULL);


CREATE INDEX OWNER_TEXT_SIDX ON OWNER_TEXT (Owner_Text_Location)
INDEXTYPE IS MDSYS.SPATIAL_INDEX_V2 PARAMETERS ('layer_gtype=POINT')